//
//  GL_TransformationCoordonation.m
//  RecipeCollection02
//
//  Created by Louis CHU on 02/03/12.
//  Copyright (c) 2012 Nathan Burba. All rights reserved.
//

#import "GL_TransformationCoordonation.h"

@implementation GL_TransformationCoordonation
+ (b2Vec2) transformTarget:(b2Vec2) target  axisDirection: (b2Vec2) axisDirection fromOrigin: (b2Vec2) fromOrigin toOrigin: (b2Vec2) toOrigin ;
{
    b2Vec2 tranformedTarget = target;
    tranformedTarget += (fromOrigin - toOrigin);
    
    float32 lengthAxisDirection = axisDirection.Length();
    float32 cosAngle = axisDirection.x/lengthAxisDirection;
    float32 sinAngle = axisDirection.y/lengthAxisDirection;
    //b2Mat22(b2Vec2(cosAngle, sinAngle), b2Vec2(-sinAngle,cosAngle));
    
    //tranformedTarget = tranformedTarget * b2Mat22(b2Vec2(cosAngle, sinAngle), b2Vec2(-sinAngle,cosAngle));
    
    //b2Transform * rotateTransform = new b2Transform(b2Vec2(),);
    tranformedTarget = b2Mul(b2Mat22(b2Vec2(cosAngle, -sinAngle), b2Vec2(sinAngle,cosAngle)), tranformedTarget);
    return tranformedTarget;
    
}


@end
